package com.share.hope.controller;

import com.share.hope.entity.result.R;
import com.share.hope.service.ProductCollectService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/share/hope/collect_product")
@RequiredArgsConstructor
@Tag(name = "收藏商品信息管理接口")
public class ProductCollectController {

    private final ProductCollectService productCollectService;

    @GetMapping("/create_collect")
    @Operation(summary = "收藏商品信息")
    public R<String> createCollect(@RequestParam Long userId, @RequestParam Long productId) {
        return productCollectService.createCollect(userId, productId);
    }

    @GetMapping("/cancel_collect")
    @Operation(summary = "取消收藏商品信息")
    public R<String> cancelCollect(@RequestParam Long userId, @RequestParam Long productId) {
        return productCollectService.cancelCollect(userId, productId);
    }

}
